package com.liked.config;

import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 路亚
 * @version 0.1
 * @className RocketmqConfig
 * @description
 * @date 2024/12/30 22:34
 * @since jdk11
 */
@Configuration
public class RocketmqConfig {

    @Bean
    public DefaultMQProducer defaultMQProducer(){
        DefaultMQProducer defaultMQProducer = new DefaultMQProducer("videoLikedRecord");
        defaultMQProducer.setNamesrvAddr("192.168.254.131:9876");
        try {
            defaultMQProducer.start();
        } catch (MQClientException e) {
            throw new RuntimeException(e);
        }
        return defaultMQProducer;
    }
}
